#include<cstdio>
#include<iostream>
using namespace std;
int n,k,l,r;
int ans = 0;
int main(){
	freopen("candy.in","r",stdin);
	
	freopen("candy.out","w",stdout);
	scanf("%d%d%d",&n,&l,&r);
	if((r/n)*n - 1 >= l){
		printf("%d",n-1);
		return 0;
	}
	ans = r % n;
	printf("%d",ans);
	return 0;
}
